package com.mia.props.common.entities;

import com.mia.props.common.TileProps;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;

public class TileDoor extends TileProps {
   public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float var7, float var8, float var9) {
      int hinge = Integer.valueOf((String)this.tileParams.get("hinge"));
      int deltaRot = (this.isRunning ? -4 : 4) * hinge;
      this.isRunning = !this.isRunning;
      this.rotation += deltaRot;
      if (this.rotation > 15) {
         this.rotation -= 16;
      }

      if (this.rotation < 0) {
         this.rotation += 16;
      }

      world.playAuxSFXAtEntity(player, 1003, x, y, z, 0);
      return true;
   }

   public int getRenderingType() {
      return this.isRunning ? Integer.valueOf((String)this.tileParams.get("linkedModel")) : this.type;
   }
}
